package com.asset.dispoal.defaultDepartment.service;

import com.asset.dispoal.defaultDepartment.api.IGbDefaultDepartmentService;
import com.asset.dispoal.defaultDepartment.dto.GbDefaultDepartmentRequest;
import com.asset.dispoal.defaultDepartment.dto.GbDefaultDepartmentResponse;
import com.asset.dispoal.defaultDepartment.service.commom.GbDefaultDepartmentDeleteCommand;
import com.asset.dispoal.defaultDepartment.service.commom.GbDefaultDepartmentInsertCommand;
import com.asset.dispoal.defaultDepartment.service.commom.GbDefaultDepartmentQueryCommand;
import com.asset.dispoal.defaultDepartment.service.commom.GbDefaultDepartmentUpdateCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tech.mhuang.pacebox.springboot.protocol.Result;

import java.util.List;

/**
 * 默认部门服务实现类
 *
 * @author: mhuang
 * @date: 2022-03-18 10:42:26
 */
@Service
public class GbDefaultDepartmentServiceImpl implements IGbDefaultDepartmentService {

    @Autowired
    GbDefaultDepartmentInsertCommand defaultDepartmentInsertCommand;

    @Autowired
    GbDefaultDepartmentUpdateCommand gbDefaultDepartmentUpdateCommand;

    @Autowired
    GbDefaultDepartmentDeleteCommand gbDefaultDepartmentDeleteCommand;

    @Autowired
    GbDefaultDepartmentQueryCommand gbDefaultDepartmentQueryCommand;


    @Override
    public Result insert(GbDefaultDepartmentRequest request) {
        return defaultDepartmentInsertCommand.execute(request);
    }

    @Override
    public Result upadte(GbDefaultDepartmentRequest request) {
        return gbDefaultDepartmentUpdateCommand.execute(request);
    }

    @Override
    public Result delete(String id) {
        return gbDefaultDepartmentDeleteCommand.execute(id);
    }

    @Override
    public Result<List<GbDefaultDepartmentResponse>> queryDefaultDepTree(String companyType) {
        return gbDefaultDepartmentQueryCommand.execute(companyType);
    }
}